// do we have a selection?
var BbSelection = window.getSelection();

// bulid the URL
var BbUrl = "http://bleetbox.com/chat?url=" +
						escape(window.location.href);

var BbAbort = false;

// make sure it's not too long...
if (BbSelection) {
	
	BbSelection = escape(BbSelection);
	
	if (BbSelection.length > 200) {
		
		alert("Oops, you've selected too much.  Select a small amount of text to discuss before clicking the Bleetbox icon.")
		BbAbort = true;
		
	} else {
		
		// add the selection to the URL
		BbUrl += "&re=" + BbSelection;
		
	}

}

if (!BbAbort) {
	
	// redirect to the bleetbox page
	window.location = BbUrl;
	
}